<!DOCTYPE html>
<html>
  <head>
    <title>Zoom Levels Tutorial - Leaflet</title>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />

    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin="" />
    <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin=""></script>

    <style>
      html,
      body {
        height: 100%;
        margin: 0;
      }
      #map {
        width: 600px;
        height: 400px;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>

    <script>
      var map = L.map('map', {
        minZoom: 1,
        maxZoom: 1,
        dragging: false
      })

      var cartodbAttribution = '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="https://carto.com/attribution">CARTO</a>'

      var positron = L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {
        attribution: cartodbAttribution
      }).addTo(map)

      L.control
        .scale({
          maxWidth: 150, // 控件的最大宽度，单位像素
          metric: true, // 是否显示公制比例线（米/公里）
          imperial: false // 是否显示英制比例线（英里/英尺）
        })
        .addTo(map)

      // 平移到赤道和北纬60°
      setInterval(function () {
        map.setView([0, 0], 0, { duration: 1, animate: true })
        setTimeout(function () {
          map.setView([60, 0], 0, { duration: 1, animate: true })
        }, 2000)
      }, 4000)

      map.setView([0, 0], 0)
    </script>
  </body>
</html>
